package com.csxh.web.service;

import com.csxh.web.dao.IDao;

public abstract class PagerService<T> implements IService<T> {

	
	private IDao<T> dao;
	
	
	public void setDao(IDao<T> dao){
		this.dao=dao;
	}
	
	public IDao<T> getDao(){
		return this.dao;
	}

	
	public Pager<T> getPager(int size) {
		long total = getDao().totalCount(); 
		return new Pager<T>(total, size);
	}

	public Pager<T> getPager(int size, String codition, Object... params) {
		long total = getDao().totalCount();
		return new Pager<T>(total, size,codition,params);
	}

	public Pager<T> getPager(int size, String orderBy) {
		long total = getDao().totalCount();
		return new Pager<T>(total, size,orderBy);
	}

	public Pager<T> getPager(int size, String orderBy, String codition, Object... params) {
		long total = getDao().totalCount();
		return new Pager<T>(total, size,orderBy,codition,params);
	}

}
